package com.example.rabbitmqconsumer.listener;

import com.alibaba.fastjson.JSONObject;
import com.example.rabbitmqconsumer.domain.User;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName UserListener
 * @Desecription TODO 1.2新增
 * @Author gjy
 * @Date 2021/4/20 14:53
 * @Version 1.2
 **/
@Component
@RabbitListener(queues = "topic.user")
public class UserListener {
    @RabbitHandler
    public void process(String s) {

        User user = JSONObject.parseObject(s, User.class);
        System.out.println("TopicManReceiver消费者收到消息  : " + user);
    }
}
